<%@ include file="../common.jsp"%>

<c:choose>
	<c:when test="${size eq 0}">
		No Records Found.
	</c:when>
	<c:otherwise>
		<div style="width: 70%;">
			<table class="viewDetails">
				<tr class="adminTableMainHeaderColor tableChildHeaderFont">
					<th colspan="5" align="center"> <span class="searchResultsCaption" > LIST OF BUISNESS UNIT(S) </span> </th>
				</tr>
				<tr class="heading">
					<th> Name </th>
					<th> Code </th>
					<th> Company </th>
					<th> Type </th>
					<th> Department(s) </th>
				</tr>	
			
				<c:forEach items="${locationMap}" var="locationMap" varStatus="loop">
						<c:set var="tabColor" value="odd"></c:set>
					     	<c:if test="${(loop.index % 2) eq 0}">
					        	<c:set var="tabColor" value="even"></c:set>
					        </c:if>
					<tr class="${tabColor}">
						<td> ${locationMap.value.ldName} </td>
						<td> ${locationMap.value.ldCode} </td>
						<td> ${locationMap.value.ldCompanyId.cdName} </td>
						<td> ${locationMap.value.ldType} </td>
						<td> <c:forEach items="${locationMap.value.departmentDetailsDTOs}" var="department">
								${department.ddName}<br>
							 </c:forEach> 
						</td>
					</tr>	
				</c:forEach>	
			</table>
		</div>
	</c:otherwise>
</c:choose>